package be.aquafin.klipdf.service;

import java.util.List;

import be.aquafin.klipdf.dao.SpatialDataDao;
import be.aquafin.klipdf.model.Objecttype;
import be.aquafin.klipdf.model.SpatialObject;
import be.aquafin.klipdf.spatial.model.SpatialTreeModel;

import com.vividsolutions.jts.geom.Geometry;

public class SpatialServiceImpl implements SpatialService {
	
	private final SpatialTreeModel spatialTreeModel = new SpatialTreeModel();

	@Override
	public List<? extends SpatialObject> getSpatialData(Objecttype objecttype, Geometry geometry) {
		return spatialTreeModel.search(objecttype, geometry);
	}
	
	public void setSpatialDataDao(SpatialDataDao spatialDataDao) {
		spatialTreeModel.store(Objecttype.KNOOP, spatialDataDao.getAllSpatialNodes());
		spatialTreeModel.store(Objecttype.LEIDING, spatialDataDao.getAllSpatialPipes());
	}
	
}